package com.xs.utils;

import org.springframework.util.DigestUtils;

public class MD5Test {
    public static void main(String[] args) {

        String pwd = "123";

        String md5DigestAsHex = DigestUtils.md5DigestAsHex(pwd.getBytes());
        System.out.println(md5DigestAsHex);

        // 为了保证密码安全
        // 1. 加盐
        // 2. 加散列次数
        String salt = "Hello.#";
        String password = DigestUtils.md5DigestAsHex((pwd + salt).getBytes());
        System.out.println(password);
    }
}
